package com.eshin.autotest.processor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author Eshin
 * @title: CustomBeanFactoryPostProcessor
 * @projectName pay
 * @date 2019/6/1717:27
 */

@Component
public class AnnoCustomBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if(beanName.contains("hello")){
            System.out.println(beanName+" proccessed by AnnoCustomBeanPostProcessor.postProcessBeforeInitialization");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if(beanName.contains("hello")){
            System.out.println(beanName+" proccessed by AnnoCustomBeanPostProcessor.postProcessAfterInitialization");
        }
        return bean;
    }
}
